--- a/usr/src/java/Makefile Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/java/Makefile Thu Jan 19 16:01:30 2012 -0500
@@ -20,15 +20,15 @@
#
#
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
-MSUBDIRS = scf vpanels
-ASUBDIRS = afunix ant lib util sleeklock adr rad
+MSUBDIRS = vpanels
+ASUBDIRS = afunix ant lib util sleeklock adr rad smf smf-old
lint:
-vpanels: afunix lib scf util adr rad sleeklock
+vpanels: afunix lib util adr rad sleeklock smf-old
adr: ant
@@ -36,8 +36,6 @@
util: lib
-scf: util adr rad
-
sleeklock: util lib
include Makefile.ant
--- a/usr/src/java/scf/Makefile Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-ASUBDIRS=common
-
-include $(SRC)/java/Makefile.ant
--- a/usr/src/java/scf/common/build.xml Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
- Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
--->
-
-<project name="scf-common" default="jar">
- <import file="../../build-common.xml" />
-
- <target name="generate_project">
- <generate.adr api="smf_old.xml" />
- <generate.adr api="smf.xml" />
- </target>
-
- <target name="install_project" depends="javadoc">
- <install.javadoc />
- </target>
-
- <path id="classpath.javac">
- <pathelement location="${ws.java}/adr/adr.jar" />
- <pathelement location="${ws.java}/rad/rad.jar" />
- </path>
-</project>
--- a/usr/src/java/scf/common/nbproject/project.xml Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
- Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
--->
-<project xmlns="http://www.netbeans.org/ns/project/1">
- <type>org.netbeans.modules.ant.freeform</type>
- <configuration>
- <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
- <name>scf-common</name>
- </general-data>
- <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
- <!-- Do not use Project Properties customizer when editing this file manually. -->
- <name>scf-common</name>
- <properties/>
- <folders>
- <source-folder>
- <label>Source Packages</label>
- <location>.</location>
- <encoding>UTF-8</encoding>
- </source-folder>
- <source-folder>
- <label>Source Packages</label>
- <type>java</type>
- <location>.</location>
- <includes>org/</includes>
- <encoding>UTF-8</encoding>
- </source-folder>
- <source-folder>
- <label>build/gen</label>
- <type>java</type>
- <location>build/gen</location>
- <includes>org/</includes>
- <encoding>UTF-8</encoding>
- </source-folder>
- </folders>
- <ide-actions>
- <action name="build">
- <target>jar</target>
- </action>
- <action name="clean">
- <target>clobber</target>
- </action>
- <action name="javadoc">
- <target>javadoc</target>
- </action>
- <action name="rebuild">
- <target>clobber</target>
- <target>jar</target>
- </action>
- </ide-actions>
- <export>
- <type>jar</type>
- <location>scf-common.jar</location>
- <build-target>jar</build-target>
- </export>
- <view>
- <items>
- <source-folder style="packages">
- <label>Source Packages</label>
- <location>.</location>
- <includes>org/</includes>
- </source-folder>
- <source-folder style="packages">
- <label>build/gen</label>
- <location>build/gen</location>
- <includes>org/</includes>
- </source-folder>
- <source-file>
- <location>build.xml</location>
- </source-file>
- </items>
- <context-menu>
- <ide-action name="build"/>
- <ide-action name="rebuild"/>
- <ide-action name="clean"/>
- <ide-action name="javadoc"/>
- </context-menu>
- </view>
- <subprojects/>
- </general-data>
- <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
- <compilation-unit>
- <package-root>.</package-root>
- <package-root>build/gen</package-root>
- <classpath mode="compile">../../rad/rad.jar</classpath>
- <built-to>scf-common.jar</built-to>
- <javadoc-built-to>build/javadoc</javadoc-built-to>
- <source-level>1.5</source-level>
- </compilation-unit>
- </java-data>
- <preferences xmlns="http://www.netbeans.org/ns/auxiliary-configuration-preferences/1">
- <module name="org-netbeans-modules-editor-indent"/>
- </preferences>
- </configuration>
-</project>
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/FMRI.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-package org.opensolaris.os.scf.common;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.beans.ConstructorProperties;
-import java.util.Map;
-import java.util.EnumMap;
-import javax.management.openmbean.*;
-
-/**
- * A basic FMRI class. Probably should be named "SmfFMRI", as
- * legacy-run services aren't an SCF concept.
- */
-public class FMRI implements Comparable<FMRI>, CompositeDataView
-{
- /*
- * Static data
- */
- public static final String SCF_SCOPE_LOCAL = "localhost";
- private static final String FORMAT =
- "([A-Za-z][_A-Za-z0-9.-]*,)?[_A-Za-z0-9-]*";
- private static final Map<FMRIScheme, String> scheme_strings =
- new EnumMap<FMRIScheme, String>(FMRIScheme.class);
-
- static {
- scheme_strings.put(FMRIScheme.FILE, "file");
- scheme_strings.put(FMRIScheme.LEGACY, "lrc");
- scheme_strings.put(FMRIScheme.SERVICE, "svc");
- }
-
- /*
- * FMRI components
- */
- private FMRIScheme scheme_;
- private String scope_ = null;
- private String service_ = null;
- private String instance_ = null;
- private String pg_ = null;
- private String property_ = null;
- private String name_ = null;
-
- /*
- * Derivative information
- */
- private FMRIType svctype_;
- private String canonicalStr_;
-
- /**
- * Creates an FMRI from a URI.
- */
- public FMRI(URI uri) throws URISyntaxException
- {
- if (!uri.isAbsolute() || uri.isOpaque())
- throw (new URISyntaxException(uri.toString(),
- "Bad FMRI"));
-
- String scheme = uri.getScheme();
- scope_ = uri.getAuthority();
- if (scope_ == null || scope_.isEmpty() ||
- scope_.equals(SCF_SCOPE_LOCAL))
- scope_ = null;
- canonicalStr_ = new URI(uri.getScheme(), scope_, uri.getPath(),
- null, null).toString();
-
- if (scheme.equals("svc")) {
- scheme_ = FMRIScheme.SERVICE;
- svctype_ = FMRIType.SCOPE;
-
- String[] top = uri.getPath().split("/:properties/", 2);
-
- String[] next = top[0].split(":", 2);
- /*
- * We can assume the path starts with a slash
- * because we reject relative URIs above.
- */
- service_ = next[0].substring(1);
- svctype_ = FMRIType.SERVICE;
- if (next.length == 2) {
- instance_ = next[1];
- if (!instance_.matches(FORMAT))
- throw (new URISyntaxException(
- uri.toString(),
- "Invalid instance: " + instance_));
- svctype_ = FMRIType.INSTANCE;
- }
-
- if (top.length == 2) {
- next = top[1].split("/", 2);
- pg_ = next[0];
- if (!pg_.matches(FORMAT))
- throw (new URISyntaxException(
- uri.toString(),
- "Invalid property group: " + pg_));
- svctype_ = FMRIType.PGROUP;
- if (next.length == 2) {
- property_ = next[1];
- if (!property_.matches(FORMAT))
- throw (new URISyntaxException(
- uri.toString(),
- "Invalid property: " +
- property_));
- svctype_ = FMRIType.PROPERTY;
- }
- }
- } else if (scheme.equals("file")) {
- scheme_ = FMRIScheme.FILE;
- name_ = uri.getPath();
- } else if (scheme.equals("lrc")) {
- scheme_ = FMRIScheme.LEGACY;
- name_ = uri.getPath();
- } else {
- throw (new URISyntaxException(uri.toString(),
- "Invalid FMRI scheme: " + scheme));
- }
- }
-
- /**
- * Creates an FMRI from a string.
- */
- public FMRI(String fmri) throws URISyntaxException
- {
- /* Work around bug 6504439 in scf_scope_to_fmri */
- this(new URI(fmri.equals("svc:") ? "svc:///" : fmri));
- }
-
- /**
- * Constucts an FMRI from its attributes. Needed for the class to be
- * reconstructable.
- */
- @SuppressWarnings({"fallthrough"})
- @ConstructorProperties({"scheme", "svcType", "scope", "name", "service",
- "instance", "propertyGroup", "property"})
- public FMRI(FMRIScheme scheme, FMRIType type, String scope, String name,
- String service, String instance, String pg, String property)
- {
- scheme_ = scheme;
-
- scope_ = scope;
- if (scope_ == null || scope_.isEmpty() ||
- scope_.equals(SCF_SCOPE_LOCAL))
- scope_ = null;
-
- String path;
- if (scheme != FMRIScheme.SERVICE) {
- svctype_ = FMRIType.NONE;
- path = name_ = name;
- } else {
- svctype_ = type;
- name_ = null;
-
- path = "";
- switch (svctype_) {
- case PROPERTY:
- property_ = property;
- path = "/" + property + path;
- case PGROUP:
- pg_ = pg;
- path = "/:properties/" + pg + path;
- case INSTANCE:
- instance_ = instance;
- path = ":" + instance + path;
- case SERVICE:
- service_ = service;
- path = "/" + service + path;
- }
- }
-
- try {
- URI uri = new URI(scheme_strings.get(scheme), scope_,
- path, null, null);
- canonicalStr_ = uri.toString();
- } catch (URISyntaxException ex) {
- canonicalStr_ = null;
- }
- }
-
- /**
- * Returns the FMRI's type (scheme).
- */
- public FMRIScheme getScheme()
- {
- return (scheme_);
- }
-
- /**
- * Returns a svc: FMRI's type.
- */
- public FMRIType getSvcType()
- {
- if (scheme_ != FMRIScheme.SERVICE)
- throw (new FMRIException(this, "not a service FMRI"));
- return (svctype_);
- }
-
- /**
- * Returns the FMRI's scope.
- */
- public String getScope()
- {
- return (scope_ == null ? SCF_SCOPE_LOCAL : scope_);
- }
-
- /**
- * Returns the name of a legacy-run or file FMRI.
- */
- public String getName()
- {
- if (scheme_ == FMRIScheme.SERVICE)
- throw (new FMRIException(this,
- "not a file or legacy FMRI"));
- return (name_);
- }
-
- /**
- * Throws an FMRIException from a function which may only be
- * called on a svc: FMRI. Takes the FMRIType required by the
- * caller.
- */
- private void checktype(FMRIType svctype)
- {
- String prefix = "unable to read " + svctype;
- if (scheme_ != FMRIScheme.SERVICE)
- throw (new FMRIException(this, prefix +
- " from non-service FMRI"));
- if (svctype_.compareTo(svctype) < 0)
- throw (new FMRIException(this, prefix +
- " from " + svctype_ + "FMRI"));
- }
-
- /**
- * Returns the service component of a service FMRI.
- */
- public String getService()
- {
- checktype(FMRIType.SERVICE);
- return (service_);
- }
-
- /**
- * Returns the instance component of a service FMRI, or {@code
- * null} if there is none.
- */
- public String getInstance()
- {
- checktype(FMRIType.INSTANCE);
- return (instance_);
- }
-
- /**
- * Returns the property group component of a service FMRI.
- */
- public String getPropertyGroup()
- {
- checktype(FMRIType.PGROUP);
- return (pg_);
- }
-
- /**
- * Returns the property component of a service FMRI.
- */
- public String getProperty()
- {
- checktype(FMRIType.PROPERTY);
- return (property_);
- }
-
- public FMRI toServiceFMRI()
- {
- checktype(FMRIType.SERVICE);
- if (svctype_ == FMRIType.SERVICE)
- return this;
- return (new FMRI(scheme_, FMRIType.SERVICE, scope_, null,
- service_, null, null, null));
- }
-
- public FMRI toInstanceFMRI()
- {
- checktype(FMRIType.INSTANCE);
- if (svctype_ == FMRIType.INSTANCE)
- return this;
- return (new FMRI(scheme_, FMRIType.INSTANCE, scope_, null,
- service_, instance_, null, null));
- }
-
- public FMRI toInstanceFMRI(String instanceName)
- {
- checktype(FMRIType.SERVICE);
- return (new FMRI(scheme_, FMRIType.INSTANCE, scope_, null,
- service_, instanceName, null, null));
- }
-
-
- /*
- * CompositeDataView methods
- */
-
- private static final String[] itemNames = new String[] { "scheme",
- "svcType", "scope", "name", "service", "instance", "propertyGroup",
- "property" };
-
- /*
- * Manually convert the FMRI to its automatically-determined
- * CompositeType. This conversion is normally performed by the
- * MXBean implementation, but the automatic conversion uses our
- * accessors to inspect the object. Performing the conversion
- * manually permits us to circumvent the run-time checking
- * performed by our accessors (or to put it differently, permits
- * us to leave the run-time checking in place).
- */
- public CompositeData toCompositeData(CompositeType ct)
- {
- Object[] itemValues = new Object[] { scheme_.name(),
- svctype_.name(), scope_, name_, service_, instance_, pg_,
- property_ };
- try {
- return (new CompositeDataSupport(ct, itemNames,
- itemValues));
- } catch (OpenDataException ex) {
- throw (new RuntimeException(ex));
- }
- }
-
- // Comparable methods
-
- private static int strcmp(String a, String b)
- {
- if (a == null)
- return (b == null ? 0 : 1);
- if (b == null)
- return (-1);
- return (a.compareTo(b));
- }
-
- public int compareTo(FMRI f)
- {
- int result = scheme_.compareTo(f.scheme_);
-
- if (result == 0)
- result = strcmp(scope_, f.scope_);
- if (scheme_ != FMRIScheme.SERVICE)
- result = strcmp(name_, f.name_);
- else {
- if (result == 0)
- result = strcmp(service_, f.service_);
- if (result == 0)
- result = strcmp(instance_, f.instance_);
- if (result == 0)
- result = strcmp(pg_, f.pg_);
- if (result == 0)
- result = strcmp(property_, f.property_);
- }
-
- return (result);
- }
-
- /*
- * Object methods
- */
-
- /**
- * Returns the FMRI as a string.
- */
- @Override
- public String toString()
- {
- return (canonicalStr_);
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (o == null)
- return (false);
-
- FMRI f;
- try {
- f = (FMRI)o;
- } catch (ClassCastException e) {
- return (false);
- }
-
- return (compareTo(f) == 0);
- }
-
- @Override
- public int hashCode()
- {
- int hash = 7;
- hash = 79 * hash +
- (this.scope_ != null ? this.scope_.hashCode() : 0);
- hash = 79 * hash +
- (this.service_ != null ? this.service_.hashCode() : 0);
- hash = 79 * hash +
- (this.instance_ != null ? this.instance_.hashCode() : 0);
- hash = 79 * hash +
- (this.pg_ != null ? this.pg_.hashCode() : 0);
- hash = 79 * hash +
- (this.property_ != null ? this.property_.hashCode() : 0);
- hash = 79 * hash +
- (this.name_ != null ? this.name_.hashCode() : 0);
- hash = 79 * hash +
- (this.scheme_ != null ? this.scheme_.hashCode() : 0);
- hash = 79 * hash +
- (this.svctype_ != null ? this.svctype_.hashCode() : 0);
- return hash;
- }
-}
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/FMRIException.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-package org.opensolaris.os.scf.common;
-
-import org.opensolaris.os.scf.*;
-
-/**
- * Runtime exception thrown for inproper acccesses to an FMRI.
- */
-@SuppressWarnings({"serial"})
-public class FMRIException extends RuntimeException implements HasFMRI
-{
- private FMRI fmri_;
-
- public FMRIException(FMRI fmri, String s)
- {
- super(s);
- fmri_ = fmri;
- }
-
- /**
- * Returns the FMRI which was improperly accessed.
- */
- public FMRI getFMRI()
- {
- return (fmri_);
- }
-}
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/FMRIScheme.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-package org.opensolaris.os.scf.common;
-
-/**
- * FMRI types, enumerated.
- */
-public enum FMRIScheme
-{
- /** A service (svc:) */
- SERVICE,
-
- /** A file (file:) */
- FILE,
-
- /** A legacy-run service (lrc:) */
- LEGACY;
-}
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/FMRIType.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-package org.opensolaris.os.scf.common;
-
-/**
- * svc: types, enumerated.
- */
-public enum FMRIType
-{
- /** Not a service FMRI */
- NONE,
-
- /** A scope */
- SCOPE,
-
- /** A service */
- SERVICE,
-
- /** An instance */
- INSTANCE,
-
- /** A property group */
- PGROUP,
-
- /** A property */
- PROPERTY
-}
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/HasFMRI.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-package org.opensolaris.os.scf.common;
-
-/**
- * Interface for objects which have FMRIs.
- */
-public interface HasFMRI
-{
- /**
- * Returns the FMRI of the object.
- */
- FMRI getFMRI();
-}
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/ScfConstants.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * ident "@(#)ScfConstants.java 1.2 07/10/18 SMI"
- */
-
-package org.opensolaris.os.scf.common;
-
-/*
- * Contains common libscf constants
- */
-public interface ScfConstants
-{
- // Public static snapshots
- String SCF_RUNNING = "running";
-
- // Property group types
- String SCF_APPLICATION_PG = "application";
-
-}
--- a/usr/src/java/scf/common/org/opensolaris/os/scf/common/ScfException.java Sun Jan 08 23:45:21 2012 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-package org.opensolaris.os.scf.common;
-
-import org.opensolaris.os.rad.ObjectException;
-import org.opensolaris.os.smf.SmfError;
-import org.opensolaris.os.smf.SmfErrorCode;
-
-/**
- * The SCF checked exeption class.
- *
- * XXX: This should be generated by ADRgen
- */
-@SuppressWarnings({"serial"})
-public class ScfException extends Exception
-{
- private SmfErrorCode error_ = null;
- private String msg_ = "";
-
- public ScfException(ObjectException e)
- {
- super(e);
- SmfError se = e.getPayload(SmfError.class);
- if (se != null) {
- error_ = se.getError();
- msg_ = se.getMessage();
- } else {
- }
- }
-
- @Override
- public String getMessage()
- {
- return (msg_);
- }
-
- /**
- * Returns the error which caused the ScfException.
- */
- public SmfErrorCode getError()
- {
- return (error_);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/build.xml Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+-->
+
+<project name="smf-old" default="jar">
+ <import file="../build-common.xml" />
+
+ <target name="generate_project">
+ <generate.adr api="smf_old.xml" />
+ </target>
+
+ <target name="install_project" depends="javadoc">
+ <install.javadoc />
+ </target>
+
+ <path id="classpath.javac">
+ <pathelement location="${ws.java}/adr/adr.jar" />
+ <pathelement location="${ws.java}/rad/rad.jar" />
+ </path>
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/FMRI.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,432 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.beans.ConstructorProperties;
+import java.util.Map;
+import java.util.EnumMap;
+import javax.management.openmbean.*;
+
+/**
+ * A basic FMRI class. Probably should be named "SmfFMRI", as
+ * legacy-run services aren't an SCF concept.
+ */
+public class FMRI implements Comparable<FMRI>, CompositeDataView
+{
+ /*
+ * Static data
+ */
+ public static final String SCF_SCOPE_LOCAL = "localhost";
+ private static final String FORMAT =
+ "([A-Za-z][_A-Za-z0-9.-]*,)?[_A-Za-z0-9-]*";
+ private static final Map<FMRIScheme, String> scheme_strings =
+ new EnumMap<FMRIScheme, String>(FMRIScheme.class);
+
+ static {
+ scheme_strings.put(FMRIScheme.FILE, "file");
+ scheme_strings.put(FMRIScheme.LEGACY, "lrc");
+ scheme_strings.put(FMRIScheme.SERVICE, "svc");
+ }
+
+ /*
+ * FMRI components
+ */
+ private FMRIScheme scheme_;
+ private String scope_ = null;
+ private String service_ = null;
+ private String instance_ = null;
+ private String pg_ = null;
+ private String property_ = null;
+ private String name_ = null;
+
+ /*
+ * Derivative information
+ */
+ private FMRIType svctype_;
+ private String canonicalStr_;
+
+ /**
+ * Creates an FMRI from a URI.
+ */
+ public FMRI(URI uri) throws URISyntaxException
+ {
+ if (!uri.isAbsolute() || uri.isOpaque())
+ throw (new URISyntaxException(uri.toString(),
+ "Bad FMRI"));
+
+ String scheme = uri.getScheme();
+ scope_ = uri.getAuthority();
+ if (scope_ == null || scope_.isEmpty() ||
+ scope_.equals(SCF_SCOPE_LOCAL))
+ scope_ = null;
+ canonicalStr_ = new URI(uri.getScheme(), scope_, uri.getPath(),
+ null, null).toString();
+
+ if (scheme.equals("svc")) {
+ scheme_ = FMRIScheme.SERVICE;
+ svctype_ = FMRIType.SCOPE;
+
+ String[] top = uri.getPath().split("/:properties/", 2);
+
+ String[] next = top[0].split(":", 2);
+ /*
+ * We can assume the path starts with a slash
+ * because we reject relative URIs above.
+ */
+ service_ = next[0].substring(1);
+ svctype_ = FMRIType.SERVICE;
+ if (next.length == 2) {
+ instance_ = next[1];
+ if (!instance_.matches(FORMAT))
+ throw (new URISyntaxException(
+ uri.toString(),
+ "Invalid instance: " + instance_));
+ svctype_ = FMRIType.INSTANCE;
+ }
+
+ if (top.length == 2) {
+ next = top[1].split("/", 2);
+ pg_ = next[0];
+ if (!pg_.matches(FORMAT))
+ throw (new URISyntaxException(
+ uri.toString(),
+ "Invalid property group: " + pg_));
+ svctype_ = FMRIType.PGROUP;
+ if (next.length == 2) {
+ property_ = next[1];
+ if (!property_.matches(FORMAT))
+ throw (new URISyntaxException(
+ uri.toString(),
+ "Invalid property: " +
+ property_));
+ svctype_ = FMRIType.PROPERTY;
+ }
+ }
+ } else if (scheme.equals("file")) {
+ scheme_ = FMRIScheme.FILE;
+ name_ = uri.getPath();
+ } else if (scheme.equals("lrc")) {
+ scheme_ = FMRIScheme.LEGACY;
+ name_ = uri.getPath();
+ } else {
+ throw (new URISyntaxException(uri.toString(),
+ "Invalid FMRI scheme: " + scheme));
+ }
+ }
+
+ /**
+ * Creates an FMRI from a string.
+ */
+ public FMRI(String fmri) throws URISyntaxException
+ {
+ /* Work around bug 6504439 in scf_scope_to_fmri */
+ this(new URI(fmri.equals("svc:") ? "svc:///" : fmri));
+ }
+
+ /**
+ * Constucts an FMRI from its attributes. Needed for the class to be
+ * reconstructable.
+ */
+ @SuppressWarnings({"fallthrough"})
+ @ConstructorProperties({"scheme", "svcType", "scope", "name", "service",
+ "instance", "propertyGroup", "property"})
+ public FMRI(FMRIScheme scheme, FMRIType type, String scope, String name,
+ String service, String instance, String pg, String property)
+ {
+ scheme_ = scheme;
+
+ scope_ = scope;
+ if (scope_ == null || scope_.isEmpty() ||
+ scope_.equals(SCF_SCOPE_LOCAL))
+ scope_ = null;
+
+ String path;
+ if (scheme != FMRIScheme.SERVICE) {
+ svctype_ = FMRIType.NONE;
+ path = name_ = name;
+ } else {
+ svctype_ = type;
+ name_ = null;
+
+ path = "";
+ switch (svctype_) {
+ case PROPERTY:
+ property_ = property;
+ path = "/" + property + path;
+ case PGROUP:
+ pg_ = pg;
+ path = "/:properties/" + pg + path;
+ case INSTANCE:
+ instance_ = instance;
+ path = ":" + instance + path;
+ case SERVICE:
+ service_ = service;
+ path = "/" + service + path;
+ }
+ }
+
+ try {
+ URI uri = new URI(scheme_strings.get(scheme), scope_,
+ path, null, null);
+ canonicalStr_ = uri.toString();
+ } catch (URISyntaxException ex) {
+ canonicalStr_ = null;
+ }
+ }
+
+ /**
+ * Returns the FMRI's type (scheme).
+ */
+ public FMRIScheme getScheme()
+ {
+ return (scheme_);
+ }
+
+ /**
+ * Returns a svc: FMRI's type.
+ */
+ public FMRIType getSvcType()
+ {
+ if (scheme_ != FMRIScheme.SERVICE)
+ throw (new FMRIException(this, "not a service FMRI"));
+ return (svctype_);
+ }
+
+ /**
+ * Returns the FMRI's scope.
+ */
+ public String getScope()
+ {
+ return (scope_ == null ? SCF_SCOPE_LOCAL : scope_);
+ }
+
+ /**
+ * Returns the name of a legacy-run or file FMRI.
+ */
+ public String getName()
+ {
+ if (scheme_ == FMRIScheme.SERVICE)
+ throw (new FMRIException(this,
+ "not a file or legacy FMRI"));
+ return (name_);
+ }
+
+ /**
+ * Throws an FMRIException from a function which may only be
+ * called on a svc: FMRI. Takes the FMRIType required by the
+ * caller.
+ */
+ private void checktype(FMRIType svctype)
+ {
+ String prefix = "unable to read " + svctype;
+ if (scheme_ != FMRIScheme.SERVICE)
+ throw (new FMRIException(this, prefix +
+ " from non-service FMRI"));
+ if (svctype_.compareTo(svctype) < 0)
+ throw (new FMRIException(this, prefix +
+ " from " + svctype_ + "FMRI"));
+ }
+
+ /**
+ * Returns the service component of a service FMRI.
+ */
+ public String getService()
+ {
+ checktype(FMRIType.SERVICE);
+ return (service_);
+ }
+
+ /**
+ * Returns the instance component of a service FMRI, or {@code
+ * null} if there is none.
+ */
+ public String getInstance()
+ {
+ checktype(FMRIType.INSTANCE);
+ return (instance_);
+ }
+
+ /**
+ * Returns the property group component of a service FMRI.
+ */
+ public String getPropertyGroup()
+ {
+ checktype(FMRIType.PGROUP);
+ return (pg_);
+ }
+
+ /**
+ * Returns the property component of a service FMRI.
+ */
+ public String getProperty()
+ {
+ checktype(FMRIType.PROPERTY);
+ return (property_);
+ }
+
+ public FMRI toServiceFMRI()
+ {
+ checktype(FMRIType.SERVICE);
+ if (svctype_ == FMRIType.SERVICE)
+ return this;
+ return (new FMRI(scheme_, FMRIType.SERVICE, scope_, null,
+ service_, null, null, null));
+ }
+
+ public FMRI toInstanceFMRI()
+ {
+ checktype(FMRIType.INSTANCE);
+ if (svctype_ == FMRIType.INSTANCE)
+ return this;
+ return (new FMRI(scheme_, FMRIType.INSTANCE, scope_, null,
+ service_, instance_, null, null));
+ }
+
+ public FMRI toInstanceFMRI(String instanceName)
+ {
+ checktype(FMRIType.SERVICE);
+ return (new FMRI(scheme_, FMRIType.INSTANCE, scope_, null,
+ service_, instanceName, null, null));
+ }
+
+
+ /*
+ * CompositeDataView methods
+ */
+
+ private static final String[] itemNames = new String[] { "scheme",
+ "svcType", "scope", "name", "service", "instance", "propertyGroup",
+ "property" };
+
+ /*
+ * Manually convert the FMRI to its automatically-determined
+ * CompositeType. This conversion is normally performed by the
+ * MXBean implementation, but the automatic conversion uses our
+ * accessors to inspect the object. Performing the conversion
+ * manually permits us to circumvent the run-time checking
+ * performed by our accessors (or to put it differently, permits
+ * us to leave the run-time checking in place).
+ */
+ public CompositeData toCompositeData(CompositeType ct)
+ {
+ Object[] itemValues = new Object[] { scheme_.name(),
+ svctype_.name(), scope_, name_, service_, instance_, pg_,
+ property_ };
+ try {
+ return (new CompositeDataSupport(ct, itemNames,
+ itemValues));
+ } catch (OpenDataException ex) {
+ throw (new RuntimeException(ex));
+ }
+ }
+
+ // Comparable methods
+
+ private static int strcmp(String a, String b)
+ {
+ if (a == null)
+ return (b == null ? 0 : 1);
+ if (b == null)
+ return (-1);
+ return (a.compareTo(b));
+ }
+
+ public int compareTo(FMRI f)
+ {
+ int result = scheme_.compareTo(f.scheme_);
+
+ if (result == 0)
+ result = strcmp(scope_, f.scope_);
+ if (scheme_ != FMRIScheme.SERVICE)
+ result = strcmp(name_, f.name_);
+ else {
+ if (result == 0)
+ result = strcmp(service_, f.service_);
+ if (result == 0)
+ result = strcmp(instance_, f.instance_);
+ if (result == 0)
+ result = strcmp(pg_, f.pg_);
+ if (result == 0)
+ result = strcmp(property_, f.property_);
+ }
+
+ return (result);
+ }
+
+ /*
+ * Object methods
+ */
+
+ /**
+ * Returns the FMRI as a string.
+ */
+ @Override
+ public String toString()
+ {
+ return (canonicalStr_);
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == null)
+ return (false);
+
+ FMRI f;
+ try {
+ f = (FMRI)o;
+ } catch (ClassCastException e) {
+ return (false);
+ }
+
+ return (compareTo(f) == 0);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 7;
+ hash = 79 * hash +
+ (this.scope_ != null ? this.scope_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.service_ != null ? this.service_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.instance_ != null ? this.instance_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.pg_ != null ? this.pg_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.property_ != null ? this.property_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.name_ != null ? this.name_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.scheme_ != null ? this.scheme_.hashCode() : 0);
+ hash = 79 * hash +
+ (this.svctype_ != null ? this.svctype_.hashCode() : 0);
+ return hash;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/FMRIException.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+import org.opensolaris.os.scf.*;
+
+/**
+ * Runtime exception thrown for inproper acccesses to an FMRI.
+ */
+@SuppressWarnings({"serial"})
+public class FMRIException extends RuntimeException implements HasFMRI
+{
+ private FMRI fmri_;
+
+ public FMRIException(FMRI fmri, String s)
+ {
+ super(s);
+ fmri_ = fmri;
+ }
+
+ /**
+ * Returns the FMRI which was improperly accessed.
+ */
+ public FMRI getFMRI()
+ {
+ return (fmri_);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/FMRIScheme.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+/**
+ * FMRI types, enumerated.
+ */
+public enum FMRIScheme
+{
+ /** A service (svc:) */
+ SERVICE,
+
+ /** A file (file:) */
+ FILE,
+
+ /** A legacy-run service (lrc:) */
+ LEGACY;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/FMRIType.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+/**
+ * svc: types, enumerated.
+ */
+public enum FMRIType
+{
+ /** Not a service FMRI */
+ NONE,
+
+ /** A scope */
+ SCOPE,
+
+ /** A service */
+ SERVICE,
+
+ /** An instance */
+ INSTANCE,
+
+ /** A property group */
+ PGROUP,
+
+ /** A property */
+ PROPERTY
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/HasFMRI.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+/**
+ * Interface for objects which have FMRIs.
+ */
+public interface HasFMRI
+{
+ /**
+ * Returns the FMRI of the object.
+ */
+ FMRI getFMRI();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/ScfConstants.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+/*
+ * Contains common libscf constants
+ */
+public interface ScfConstants
+{
+ // Public static snapshots
+ String SCF_RUNNING = "running";
+
+ // Property group types
+ String SCF_APPLICATION_PG = "application";
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf-old/org/opensolaris/os/scf/common/ScfException.java Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.scf.common;
+
+import org.opensolaris.os.rad.ObjectException;
+import org.opensolaris.os.smf.SmfError;
+import org.opensolaris.os.smf.SmfErrorCode;
+
+/**
+ * The SCF checked exeption class.
+ *
+ * XXX: This should be generated by ADRgen
+ */
+@SuppressWarnings({"serial"})
+public class ScfException extends Exception
+{
+ private SmfErrorCode error_ = null;
+ private String msg_ = "";
+
+ public ScfException(ObjectException e)
+ {
+ super(e);
+ SmfError se = e.getPayload(SmfError.class);
+ if (se != null) {
+ error_ = se.getError();
+ msg_ = se.getMessage();
+ } else {
+ }
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return (msg_);
+ }
+
+ /**
+ * Returns the error which caused the ScfException.
+ */
+ public SmfErrorCode getError()
+ {
+ return (error_);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/smf/build.xml Thu Jan 19 16:01:30 2012 -0500
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+-->
+
+<project name="smf" default="jar">
+ <import file="../build-common.xml" />
+
+ <target name="generate_project">
+ <generate.adr api="smf.xml" />
+ </target>
+
+ <target name="install" depends="jar,install_project,javadoc">
+ <install.default targetdir="${proto.rad.java}" />
+ <install.javadoc />
+ </target>
+
+ <path id="classpath.javac">
+ <pathelement location="${ws.java}/adr/adr.jar" />
+ <pathelement location="${ws.java}/rad/rad.jar" />
+ </path>
+</project>
--- a/usr/src/java/vpanels/app/build-panels.xml Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/java/vpanels/app/build-panels.xml Thu Jan 19 16:01:30 2012 -0500
@@ -19,7 +19,7 @@
CDDL HEADER END
- Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
-->
<project name="panelsdef">
@@ -58,7 +58,7 @@
</target>
<path id="classpath.panels">
- <pathelement location="${ws.java}/scf/common/scf-common.jar" />
+ <pathelement location="${ws.java}/smf-old/smf-old.jar" />
<pathelement location="${ws.java}/util/vpanels-util.jar" />
<pathelement
location="${ws.java}/vpanels/panel/vpanels-panel.jar" />
--- a/usr/src/java/vpanels/client/build.xml Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/java/vpanels/client/build.xml Thu Jan 19 16:01:30 2012 -0500
@@ -19,7 +19,7 @@
CDDL HEADER END
- Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
-->
<project name="vpanels-client" default="jar">
@@ -68,6 +68,6 @@
<path id="classpath.jar">
<path refid="classpath.javac" />
- <pathelement location="${ws.java}/scf/common/scf-common.jar" />
+ <pathelement location="${ws.java}/smf-old/smf-old.jar" />
</path>
</project>
--- a/usr/src/java/vpanels/panel/build.xml Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/java/vpanels/panel/build.xml Thu Jan 19 16:01:30 2012 -0500
@@ -19,7 +19,7 @@
CDDL HEADER END
- Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
-->
<project name="vpanels-panel" default="jar">
@@ -40,7 +40,7 @@
<path id="classpath.javac">
<fileset refid="ws.extlibs" />
<pathelement location="${ws.java}/util/vpanels-util.jar" />
- <pathelement location="${ws.java}/scf/common/scf-common.jar" />
+ <pathelement location="${ws.java}/smf-old/smf-old.jar" />
<pathelement location="${ws.java}/rad/rad.jar" />
<pathelement location="${ws.java}/adr/adr.jar" />
</path>
--- a/usr/src/pkg/manifests/system-management-rad-module-rad-smf.p5m Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/pkg/manifests/system-management-rad-module-rad-smf.p5m Thu Jan 19 16:01:30 2012 -0500
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#
license cr_Oracle license=cr_Oracle
@@ -32,8 +32,10 @@
dir path=usr group=sys
dir path=usr/lib
dir path=usr/lib/rad
+dir path=usr/lib/rad/java
dir path=usr/lib/rad/module
-file path=usr/lib/rad/module/mod_smf_old.so
file path=usr/lib/rad/module/mod_smf.so
# Future: usr/lib/rad/apis/smf.xml
+dir path=usr/share group=sys
+file path=usr/lib/rad/java/smf.jar
depend fmri=pkg:/system/management/rad@$(PKGVERS) type=require
--- a/usr/src/pkg/manifests/system-management-visual-panels-core.p5m Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/pkg/manifests/system-management-visual-panels-core.p5m Thu Jan 19 16:01:30 2012 -0500
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
license cr_Oracle license=cr_Oracle
@@ -39,6 +39,7 @@
file path=usr/lib/rad/module/mod_files.so
file path=usr/lib/rad/module/mod_network.so
file path=usr/lib/rad/module/mod_panels.so
+file path=usr/lib/rad/module/mod_smf_old.so
dir path=usr/share group=sys
dir path=usr/share/lib group=sys
dir path=usr/share/lib/xml group=sys
@@ -55,7 +56,7 @@
file path=usr/share/vpanels/conf/browser.xml
file path=usr/share/vpanels/java.policy
dir path=usr/share/vpanels/locale
-file path=usr/share/vpanels/scf-common.jar
+file path=usr/share/vpanels/smf-old.jar
file path=usr/share/vpanels/swingx-0.9.3.jar
file path=usr/share/vpanels/vpanels-client.jar
file path=usr/share/vpanels/vpanels-panel.jar
--- a/usr/src/test/java/Makefile Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/test/java/Makefile Thu Jan 19 16:01:30 2012 -0500
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#
include ../../Makefile.env
@@ -32,7 +32,7 @@
DEPENDENCY_JARS = $(PROTO_RAD_JAVA)/rad.jar
DEPENDENCY_JARS += $(PROTO_RAD_JAVA)/adr.jar
DEPENDENCY_JARS += $(PROTO_RAD_JAVA)/afunix.jar
-DEPENDENCY_JARS += $(PROTO_VP_DIR)/scf-common.jar
+DEPENDENCY_JARS += $(PROTO_RAD_JAVA)/smf.jar
DEPENDENCY_JARS += /usr/share/lib/java/junit.jar
JAVA_OPTS = -g -Xlint -Xlint:-serial
--- a/usr/src/test/java/build.xml Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/test/java/build.xml Thu Jan 19 16:01:30 2012 -0500
@@ -19,7 +19,7 @@
CDDL HEADER END
- Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-->
<project name="test" default="build">
@@ -37,8 +37,8 @@
<property name="path.adr" location="${path.rad.java}/adr.jar" />
<property name="path.rad" location="${path.rad.java}/rad.jar" />
<property name="path.util" location="${path.rad.java}/afunix.jar" />
- <property name="path.scf"
- location="${path.proto}/usr/share/vpanels/scf-common.jar" />
+ <property name="path.smf" location="${path.rad.java}/smf.jar" />
+
<path id="srcroots">
<pathelement location="${path.src}" />
<pathelement location="${path.gen}" />
@@ -48,7 +48,7 @@
<pathelement location="${path.adr}" />
<pathelement location="${path.rad}" />
<pathelement location="${path.util}" />
- <pathelement location="${path.scf}" />
+ <pathelement location="${path.smf}" />
<pathelement location="/usr/share/lib/java/junit.jar" />
</path>
--- a/usr/src/test/radtest/java.py Sun Jan 08 23:45:21 2012 -0500
+++ b/usr/src/test/radtest/java.py Thu Jan 19 16:01:30 2012 -0500
@@ -21,7 +21,7 @@
#
#
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#
import radtest.fw as fw
@@ -34,7 +34,6 @@
_VP_DIR = "usr/lib/rad/java"
_JUNIT_JAR = "/usr/share/lib/java/junit.jar"
-_SCF_JAR = "usr/share/vpanels/scf-common.jar"
class JavaExecutor(fw.ExtTestFinder):
""" Finds tests matching a particular pattern and executes them """
@@ -47,12 +46,10 @@
def make_classpath(self, root, dir):
vproot = os.path.join(root, _VP_DIR)
- vpjars = [ "rad.jar", "adr.jar", "afunix.jar" ]
- scfjar = os.path.join(root, _SCF_JAR)
+ vpjars = [ "rad.jar", "adr.jar", "afunix.jar", "smf.jar" ]
classpathents = map(lambda x: os.path.join(vproot, x), vpjars)
classpathents.append(_JUNIT_JAR)
- classpathents.append(scfjar)
classpathents.append(dir)
return ":".join(classpathents)